<style>
	.coloryellow{background-color:#C96; }
</style>
<script>
	$(document).ready(function(){
		$("#selected-all").click(function()				
		{
			var checked_status = this.checked;
			$(".select-check").each(function()
				{
					this.checked = checked_status; 
				});
		});	
		$('.pqty').keyup(function() {
			$(this).addClass('coloryellow');
			var e_qty_val = $(this).attr('value');
			var e_master_id = $(this).attr('accesskey');
			var dataString = 'e_qty_val='+e_qty_val+'& e_master_id='+e_master_id+'& Main=Quantity';
				$.ajax
					({
						type: "POST",
						url: "<?php
							echo $website_url . 'sellers/update_inventory/';
					?>",
						data: dataString,
						cache: false,
						success: function(html)
						{
						   $(this).parent().html(html);
						}
					});
		});
		$('.pprice').keyup(function() {
			$(this).addClass('coloryellow');
			var e_price_val = $(this).attr('value');
			var e_master_id = $(this).attr('accesskey');
			//alert(e_qty_val);
			
			var dataString = 'e_price_val='+e_price_val+'& e_master_id='+e_master_id+'& Main=Price';
				$.ajax
					({
						type: "POST",
						url: "<?php
echo $website_url . 'sellers/update_inventory/';
?>",
						data: dataString,
						cache: false,
						success: function(html)
						{
						   $(this).parent().html(html);
						}
					});
		});
	
		$('#IDSaveInventory').click(function(){
			$('.coloryellow').removeClass('coloryellow');
		});	
			
	});
</script>
<div class="def_width_100 f_left">
<div class="pad_10"></div>
<div class="paging_gray">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
     <tr>
          <td width="24%">
		<?php echo $form->create('Seller', array('action'=>"products_search", 'id'=>'SellerLoginForm')) ?>
            <input type="text" class="text_ser" style=" width:225px; margin-right:10px;" 
            placeholder="Enter your product name, UPC, EAN, WISN" required="required" name="data[Product][Search]" >
            <input name="" type="submit" value="Search" class="form_btn_2"/>
        <?php echo $form->end(); ?>
          </td>
         <!-- <td width="14%"><span class="seller_drop">
                <a class="org_link" href="javascript:void(0);">Action</a>
        <div class="seller_drop_conn" style=" line-height:20px;">
                        <div class="arrow_up"></div>
                        <ul>
                        	<li>
		                    	<a class="blue_link" href="/MarketPlace/Sellers/add_a_product/OQ==/access:accessed">Edit</a> 
                            </li>
                            <li>
							<a onclick="return confirm('Are you sure?');" id="alink" href="/MarketPlace/sellers/delete_by_id/MasterProduct/9/inventory">Delete List</a></li>
                           
                        </ul>
                        </div>
				</span></td>-->
          <td width="10%;">
          <?php echo $html->link('Add Product', array('controller'=>'Sellers', 'action'=>'add_a_product'), array('class'=>'org_link')); ?>
         </td>
          <td width="10%"><a href="javascript:void(0);" id="IDSaveInventory" class="org_link">Save</a></td>
         <td width="40%">&nbsp;</td>
         
     </tr>
</table>


</div>

</div>
    <div class="width_15 f_left">
		<?php echo $this->element('Seller_left'); ?> 
	</div>
    <div class="width_74 f_right">
  <table width="100%" cellspacing="0" cellpadding="0" border="0" class="grid_table_list_2" style="font-size:12px; padding:8px 4px 0px 0px">
    <tr class="tGb_blk">
        <th width="3%"><input id="selected-all" name="" type="checkbox"></th>
        <th width="5%">Action</th>
        <th width="7%">Status</th>
        <th width="10%">Merchant SKU</th>
        <th width="12%">WSIN/ISBN</th>
        <th width="24%">Product Name</th>
       <!-- <th width="6%">MPercent</th>-->
        <th width="9%">Created</th>
        <th width="6%"> Quantity</th>
        <th width="7%">Shipping</th>
        <th width="6%">Condition</th>
        <th width="9%">Your Price</th>
        <!--<th width="9%"> Initiated By</th>-->
    </tr>    
    <?php
		if(isset($products) and ($products))
		{
	?>
          
	<?php
	$x =0;
   foreach($products as $product)
		{
			if($x%2==0)
				{
					$color= "#EFEFEF";
				}
			else{
					$color= "#EFEFEF";
				}
		  ?>
      <tr bgcolor="<?php echo $color; ?>">
        <td width="3%"><input type="checkbox" value="<?php echo $product['Product']['MasterProduct']['id']; ?>" class="select-check"></td>
        <td width="5%">
        	<span class="seller_drop">
                <a href="javascript:void(0);" class="blue_link">Action</a>
        <div class="seller_drop_conn">
                        <div class="arrow_up"></div>
                        <ul>
                        	<li>
		                    	<?php 
			if(isset($product['Product']['fullfiled_by']) and ($product['Product']['fullfiled_by']=='Admin'))
				{
					$link_Type = "noaccessed";
					echo $html->link('Edit', array('action'=>'DisplaySelectedItem',
					'access'=>''.$link_Type.'','Wisn'=>$product['Product']['wisn'],  base64_encode($product['Product']['MasterProduct']['id'])));	
				}
			else{
					$link_Type = "accessed";
					echo $html->link('Edit', array('action'=>'add_a_product',
					'access'=>''.$link_Type.'', base64_encode($product['Product']['MasterProduct']['id'])),array('class'=>'blue_link'));	
				}
		?> 
                            </li>
                            <li>
							<?php
                            	echo $html->link('Delete List',
					array('controller'=>'sellers', 'action' => 'delete_by_id',
					'MasterProduct',$product['Product']['MasterProduct']['id'],'inventory'), array('escape' => false,'id'=>'alink'), 'Are you sure?');
							?></li>
                           <!-- <li>Copy to a new product</li>
                            <li>Add another condition</li>-->
                        </ul>
                        </div>
				</span>
        
        </td>
        <td width="7%">
        <?php
			if(isset($product['Product']['MasterProduct']['qty']) and ($product['Product']['MasterProduct']['qty']>0))
				{
					echo "Active";
				}
			else
				{
					echo "Inactive (Out of Stock)";
				}
		?>
        </td>
        <td width="10%"><?php echo $product['Product']['MasterProduct']['sku'];  ?></td>
        <td width="12%">
		<?php echo $html->link($product['Product']['wisn'],
					array('controller'=>'products','action'=>'product',
					$product['Product']['slug']),array('class'=>'blue','target'=>'_blank'));
			   ?>
	   </td>
        <td width="24%">
		<?php echo $html->link( substr($product['Product']['name'], 0, 20),
					array('controller'=>'products','action'=>'product',
					$product['Product']['slug']),array('class'=>'blue','target'=>'_blank'));
			   ?>
		</td>
        <!-- <td width="6%">
		 <?php
		 		
			/*if(isset($product['Product']['fullfiled_by']) and ($product['Product']['fullfiled_by']=='Admin'))
				{
					echo $product['Product']['Category']['price_percentage']; 
				}
			else{
					echo $product['Product']['Category']['merchant_percentage']; 
				}*/

		
		?>% 
		</td>-->
        <td width="9%"><?php echo $product['Product']['MasterProduct']['created'];  ?> </td>
        <td width="6%"><input  id="<?php echo $product['Product']['MasterProduct']['id']; ?>pqty" type="text" class="text_40 pqty" accesskey="<?php echo $product['Product']['MasterProduct']['id']; ?>" name="data[Product][qty]" value="<?php echo $product['Product']['MasterProduct']['qty'];  ?>"></td>
        <td width="6%"><?php echo $product['Product']['MasterProduct']['shipping_method'];  ?> </td>
        <td width="8%"><?php echo $product['Product']['Pcondition']['name'];  ?></td>
        <td width="7%">$<input style="width: 63px;"  id="<?php echo $product['Product']['MasterProduct']['id']; ?>pprice"  type="text" class="text_40 pprice" accesskey="<?php echo $product['Product']['MasterProduct']['id']; ?>" name="LowPrice" value="<?php echo $product['Product']['MasterProduct']['price'];  ?>"></td>
      <!--  <td width="9%"><?php //echo $product['Product']['fullfiled_by']; ?></td>-->
      </tr>
      <?php
		$x++;
		}
		?>
    
    <?php
		}
	?>
  </table>
 
 <div class="pad_10"></div>
  <div class="paging_gray">
  <?php
	  echo $this->element('paging');
  ?>
  </div>
</div>
